<div class="panel panel-default">
    <div class="panel-heading">{{('crm.component.customer.heading' | translate) || '客户信息'}}</div>
    <div class="panel-body">
      <form class="form-horizontal" role="form" #valForm="ngForm">
        <input type="hidden" name="customer.modifyTag" [(ngModel)]="customer.modifyTag"/>
        <div class="form-group">
          <label for="custType" class="col-lg-2 control-label">
          	{{('crm.component.customer.custType' | translate) || '新建/选择：'}} 
          </label>
          <div class="col-lg-3">
            <ng-select #custTypeSelect name="customer.custType" [(ngModel)]="customer.custType" (selected)="custTypeSelected($event)" 
            	placeholder="{{('crm.component.customer.custTypePlaceholder' | translate) || '--类型--'}}"> </ng-select>
          </div>
          <label for="custName" class="col-lg-2 control-label">{{('crm.component.customer.custName' | translate) || '客户名称：'}}</label>
          <div *ngIf="customer.custType == '0'" class="col-lg-3">
            <input name="custName" [(ngModel)]="customer.custName" class="form-control" #custName="ngModel" required
                  type="text" placeholder="{{('crm.component.customer.custNamePlaceholder' | translate) || '请输入客户名称'}}" 
                  maxlength=98/>
          </div>
          <div *ngIf="customer.custType == '1'" class="col-lg-3">
            <ng-select [required]="true" #custSelect (selected)="custSelected($event)" 
            	placeholder="{{('crm.component.customer.custSelectPlaceholder' | translate) || '--请选择客户--'}}"> </ng-select>
          </div>        
        </div>
        <div class="form-group">
          <label for="customer.contactName" class="col-lg-2 control-label">{{('crm.component.customer.contactName' | translate) || '联系人：'}}</label>
          <div class="col-lg-3">
            <input name="customer.contactName" [(ngModel)]="customer.contactName" class="form-control" #custContactName="ngModel" 
            	required type="text" placeholder="{{('crm.component.customer.contactNamePlaceholder' | translate) || '请输入联系人'}}" 
            	maxlength=50/>            
          </div>
          <label for="customer.contactPhone" class="col-lg-2 control-label">{{('crm.component.customer.contactPhone' | translate) || '联系电话：'}}</label>
          <div class="col-lg-3">
            <input name="customer.contactPhone" [(ngModel)]="customer.contactPhone" class="form-control" #custContactPhone="ngModel" 
            	required type="text" placeholder="{{('crm.component.customer.contactPhonePlaceholder' | translate) || '请输入联系电话'}}" 
            	phoneValidate/>
          </div>
        </div>        
        <div class="form-group">
          <label for="customer.industry" class="col-lg-2 control-label">{{('crm.component.customer.industry' | translate) || '所属行业：'}}</label>
          <div class="col-lg-3">
            <ng-select [required]="true" [(ngModel)]="customer.industry" name="customer.industry" [disabled]="customer.readOnly" 
            	#industry (selected)="industrySelected($event)" placeholder="{{('crm.component.customer.industryPlaceholder' | translate) || '--请选择所属行业--'}}"> 
            </ng-select>
          </div>
           <label for="customer.contactEmail" class="col-lg-2 control-label">{{('crm.component.customer.contactEmail' | translate) || '企业邮箱：'}}</label>
          <div class="col-lg-3">
            <input name="customer.contactEmail" [(ngModel)]="customer.contactEmail" class="form-control" #custContactEmail="ngModel" 
            	required email type="text" (change)="isExistsAccount()" [placeholder]="('crm.component.customer.contactEmailPlaceholder' | translate) || '请输入企业邮箱'" />
          </div>               
        </div>
        <div class="form-group" *ngIf="user.checkUserFunction('JD_CHANNEL')">
          <label for="customer.companyCode" class="col-lg-2 control-label">{{('crm.component.customer.companyCode' | translate) || '云平台客户ID：'}}</label>
          <div *ngIf="customer.custType == '0'" class="col-lg-3">
            <input [readOnly]="customer.readOnly" name="customer.companyCode" [(ngModel)]="customer.companyCode" 
                class="form-control" #companyCode="ngModel" required type="text" 
                placeholder="{{('crm.component.customer.companyCodePlaceholder' | translate) || '请输入客户唯一ID'}}"
                maxlength=10/>
          </div>
          <div *ngIf="customer.custType == '1'" class="col-lg-3">
            <ng-select [required]="true" (selected)="companyCodeSelected($event)" #companyCodeSelect 
            	placeholder="{{('crm.component.customer.companyCodeSelectPlaceholder' | translate) || '--请选择客户--'}}"> </ng-select>
          </div>
           <label for="" class="col-lg-2 control-label"></label>
          <div class="col-lg-3">
          </div>               
        </div>        
      </form>
    </div>
  </div>